package core.proto;

import java.awt.Color;
import java.awt.Font;

import javax.swing.Icon;
import javax.swing.JLabel;

class IconData extends JLabel
{
  protected Icon   m_icon;
  protected Icon   m_closedIcon;
  protected Icon   m_expandedIcon;
  protected Object m_data;
  protected Object m_label;
  protected Color  m_backgroudColor;

  public IconData(Icon icon, Color bg,Font font, Object data)
  {
       super(data.toString(),icon,LEFT);
       m_icon = icon;
       m_closedIcon = icon;
       m_expandedIcon = null;
       m_data = data;
       this.setBackground(bg);
       this.setFont(font);
    //m_label= label;
  }

  public IconData(Icon icon, Icon expandedIcon, Color bg, Font font, Object data)
  {
	super(data.toString(),icon,LEFT);
    m_icon = icon;
    m_closedIcon = icon;
    m_expandedIcon = expandedIcon;
    m_data = data;
    m_backgroudColor = Color.WHITE;
    this.setBackground(bg);
    this.setFont(font);
    //m_label= label;
  }

  public void setIcon(Icon icon){
	  m_icon=icon;
  }
  
  public Icon getIcon() 
  { 
	 Icon icon = m_icon;
     return icon;
  }

  public Icon getExpandedIcon() 
  { 
    Icon icon = m_expandedIcon!=null ? m_expandedIcon : m_icon;
    return icon;
  }

  public Object getObject() 
  { 
    return m_data;
  }

  public String toString() 
  { 
    return m_data.toString();
  }
}